package com.example.othree.service.impl;

import com.example.othree.entity.MainCrops;
import com.example.othree.mapper.MainCropsMapper;
import com.example.othree.service.MainCropsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class MainCropsServiceImpl implements MainCropsService {

    @Resource
    MainCropsMapper mainCropsMapper;

    @Override
    public List<MainCrops> cropsData(String city, String year, String crop) {
        List<MainCrops> retrunList = null;
        if (city.equals("邢台")){
            retrunList = mainCropsMapper.CropsByYearDataXt(year, crop);
        }else if (city.equals("衡水")){
            retrunList = mainCropsMapper.CropsByYearDataHs(year, crop);
        }
        return retrunList;
    }

    @Override
    public List<MainCrops> cropsDataForYear(String city, String district, String startYear, String endYear, String crop) {
        List<MainCrops> retrunList = null;
        if (city.equals("邢台")){
            retrunList = mainCropsMapper.CropsForYearDataXt(district, startYear, endYear, crop);
        }else if (city.equals("衡水")){
            retrunList = mainCropsMapper.CropsForYearDataHs(district, startYear, endYear, crop);
        }
        return retrunList;
    }
}
